// JavaScript Document
define(function(require,exports,module){
	$(function(){
		$(".open_close.open").click(function(){
			var next=D($(this).parent()[0]).next();
			next.style.display="block";
		});	
		$(".open_close.close").click(function(){
			var next=$(this).parent()[0];
			next.style.display="none";
		});	
	});
	var all_feilei_list=document.getElementById("all_feilei_list");
	var already_fenlei=document.getElementById("already_fenlei");
	$(all_feilei_list).bind("click",function(event){
		var target=event.target.parentNode;
		if($(target).hasClass("item")){
			var already_child=D(already_fenlei).getChild();
			for(var i=0,len=already_child.length;i<len;i++){
				if(already_child[i].getAttribute("already_id")==target.id){
					return null;	
				}	
			}
			var span=createElem({
				nodeName:"span",
				className:"inline_block item",
				already_id:target.id,
				innerHTML:target.innerHTML
			});	
			console.log(span);
			already_fenlei.appendChild(span);
		}
	});
	
	$(already_fenlei).bind("click",function(event){
		var target=event.target.parentNode;
		if($(target).hasClass("item")){
			$(target).remove();
		}
	});
});